﻿using MediatR;
using Product.Domain;
using Product.Infrstructre.Impl;
using Product.Read.API.Applcation.Command;

namespace Product.Read.API.Applcation.CommandHandlers
{
    /// <summary>
    /// 反填产品分类
    /// </summary>
    public class ProductSetCommandHandler : IRequestHandler<ProductSetCommand, ProductType>
    {
        protected readonly IbaseProductRepository ibaseProductRepository;

        public ProductSetCommandHandler(IbaseProductRepository ibaseProductRepository)
        {
            this.ibaseProductRepository = ibaseProductRepository;
        }

        public async Task<ProductType> Handle(ProductSetCommand request, CancellationToken cancellationToken)
        {
            return await ibaseProductRepository.GetAllByIdAsync(request.id);
        }
    }
}
